# $Id: PKGBUILD 56402 2011-10-07 09:48:12Z spupykin $
# Maintainer: Florian Pritz <bluewind@xinu.at> 
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=perl-crypt-openssl-rsa
pkgver=0.28
pkgrel=12
pkgdesc="Interface to OpenSSL RSA methods"
arch=('i686' 'x86_64')
url="http://search.cpan.org/dist/Crypt-OpenSSL-RSA"
depends=('perl-crypt-openssl-random' 'perl-crypt-openssl-bignum')
license=('GPL')
options=('!emptydirs')
source=("http://search.cpan.org/CPAN/authors/id/P/PE/PERLER/Crypt-OpenSSL-RSA-$pkgver.tar.gz"
        "0001-Adapt-to-OpenSSL-1.1.0.patch")
md5sums=('86217a5036fc63779c30420b5fd84129'
         '52ace15b09cfe54b41e4a86f3461ab9c')

prepare() {
  cd  "$srcdir/Crypt-OpenSSL-RSA-$pkgver"
  patch -p1 -i "$srcdir/0001-Adapt-to-OpenSSL-1.1.0.patch"
}

build() {
  cd  "$srcdir/Crypt-OpenSSL-RSA-$pkgver"
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd  "$srcdir/Crypt-OpenSSL-RSA-$pkgver"

  make test
}

package() {
  cd  "$srcdir/Crypt-OpenSSL-RSA-$pkgver"
  make pure_install doc_install DESTDIR="$pkgdir"
# template start; name=perl-binary-module-dependency; version=1;
if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then
	_perlver_min=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')
	_perlver_max=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);')
	depends+=("perl>=$_perlver_min" "perl<$_perlver_max")
fi
# template end;
}
